//
//  CenterworkCell.m
//  HCFrame
//
//  Created by 丁 一 on 2018/5/23.
//  Copyright © 2018年 丁 一. All rights reserved.
//

#import "CenterworkCell.h"

@implementation CenterworkCell

-(instancetype)initWithFrame:(CGRect)frame{
    if (self=[super initWithFrame:frame]) {
        if (!_logo) {
            _logo=[[UIImageView alloc] initWithFrame:CGRectMake(frame.size.width/2-23, 27, 46, 46)];
            _logo.contentMode=UIViewContentModeScaleAspectFill;
            _logo.layer.cornerRadius=23;
            _logo.layer.masksToBounds=YES;
        }
        [self addSubview:_logo];
        
        if (!_title) {
            _title=[[UILabel alloc] initWithFrame:CGRectMake(10, 85, frame.size.width-20, 30)];
            _title.numberOfLines=2;
            _title.textAlignment=NSTextAlignmentCenter;
            _title.textColor=NewsTitleColor;
            _title.font=[UIFont boldSystemFontOfSize:15];
        }
        [self addSubview:_title];
        
        if (!_bottom) {
            _bottom = [CALayer new];
            _bottom.frame=CGRectMake(0, frame.size.height-0.3, frame.size.width, 0.3);
            _bottom.backgroundColor = LineColor.CGColor;
        }
        [self.layer addSublayer:_bottom];
        
        if (!_left) {
            _left = [CALayer new];
            _left.frame=CGRectMake(0, 0, 0.5, frame.size.height-0.5);
            _left.backgroundColor = LineColor.CGColor;
        }
        [self.layer addSublayer:_left];
        
    }
    return self;
}

-(void)setModel:(LearnModel *)Model{
    _Model=Model;
    
    _title.text=_Model.learn_tittle;
    [_logo sd_setImageWithURL:[NSURL URLWithString:_Model.learn_logo]];
}

@end
